package com.gxuwz.eschool;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
//修改密码
public class ChangePasswordActivity extends AppCompatActivity {

    private ImageView iv_back;
    private Button btn_change_password;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_password);
        iv_back = findViewById(R.id.iv_back);
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 使用SupportFragmentManager来管理Fragment事务
                FragmentManager fragmentManager = getSupportFragmentManager();

                // 检查是否有Fragment可以回退
                if (fragmentManager.getBackStackEntryCount() > 0) {
                    fragmentManager.popBackStack(); // 返回上一个Fragment
                } else {
                    // 如果没有Fragment可以回退，可以结束当前Activity
                    finish();
                }
            }
        });
        btn_change_password = findViewById(R.id.btn_change_password);
        btn_change_password.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new AlertDialog.Builder(ChangePasswordActivity.this)
                        .setTitle("提示")
                        .setMessage("密码修改成功！")
                        .setPositiveButton("完成", null)
                        .show();
            }
        });
    }
}